import 'package:favor_cate/ui/pages/filter/filter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:favor_cate/core/extension/int_extension.dart';

class HomeDraw extends StatelessWidget {
  const HomeDraw({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 400.px,
      child: Drawer(
        child: Column(
          children: [
            buildContainer(context),
            GestureDetector(
              child: buildListTile(context, Icon(Icons.restaurant), "进食"),
              onTap: () {Navigator.of(context).pop();},
            ),
            GestureDetector(
              child: buildListTile(context, Icon(Icons.settings), "过滤"),
              onTap: () {Navigator.of(context).pushNamed(FilterScreen.routeName);},
            )
          ],
        ),
      ),
    );
  }

  Container buildContainer(BuildContext context) {
    return Container(
            color: Colors.red,
            alignment: Alignment(0, 0.5),
            width: double.infinity,
            height: 250.px,
            child: Text(
              "开始动手",
              style: Theme.of(context).textTheme.headline4!.copyWith(
                    fontWeight: FontWeight.bold,
                  ),
            ),
          );
  }

  Widget buildListTile(BuildContext context, Icon icon, String title) {
    return ListTile(
      leading: icon,
      title: Text(title, style: Theme.of(context).textTheme.headline3,),
    );
  }
}
